
<template>
  <div @click="go">page1</div>
  <div @click="loginClick">login</div>
  <div>{{ userInfo.name }}</div>
</template>

<script>
import {mapState} from "pinia";
import useUserStore from "../store/index.js";

export default {
  name: "Page1",
  computed: {
    ...mapState(useUserStore,['login','userInfo'])
  },
  methods: {
    go(){
      this.$router.push('/page2')
    },
    loginClick(){
      this.login({name:'hello'})
    }
  }
}
</script>

<style scoped>

</style>